<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>修改数据表</title>
    <link rel="stylesheet" href="../../../yl/index.css" />
    <!-- 布局样式 -->
    <link rel="stylesheet" href="../../../yl/style.css" />
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../yl/mobile.css" />
    <link rel="stylesheet" href="../../../yl/easyui.css" />
    <link rel="stylesheet" href="../../../yl/icon.css" />
    <style>
        #colum .el-descriptions__label {
            width: 90px;
        }

        .el-table th.el-table__cell {
            background-color: #f2f2f2;
            height: 50px;
            color: #5b6069;
        }
    </style>
</head>

<body>
    <!-- <div id="app"> -->
    <div class="easyui-navpanel" id="app" v-cloak>
        <header>
            <div class="m-toolbar">
                <div class="m-title">修改数据表信息</div>
            </div>
        </header>
        <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px">
            <div class="yl-main">
                <div class="table_titel">
                    <div class="titel">表</div>
                </div>
                <el-form :model="form" ref="form" :inline-message="true" style="width: 100%">
                    <el-descriptions :column="2" size="large" border>
                        <el-descriptions-item>
                            <template #label>
                                <div class="cell-item">表名</div>
                            </template>
                            <el-form-item prop="TABLE_NAME"
                                :rules="[{ required: true, message: '请输入表名', trigger: 'blur' }]">
                                <el-input disabled v-model="form.TABLE_NAME" class="borderless-input"
                                    placeholder="请输入表名" />
                            </el-form-item>
                        </el-descriptions-item>
                        <el-descriptions-item>
                            <template #label>
                                <div class="cell-item">表备注</div>
                            </template>
                            <el-form-item prop="TABLE_COMMENT"
                                :rules="[{ required: true, message: '请输入表备注', trigger: 'blur' }]">
                                <el-input v-model="form.TABLE_COMMENT" class="borderless-input" placeholder="请输入表备注" />
                            </el-form-item>
                        </el-descriptions-item>
                    </el-descriptions>
                </el-form>
                <el-tabs style="margin-top: 20px;" type="border-card">
                    <el-tab-pane label="栏位" style="height: 100%;">
                        <el-form id="colum" :model="{formData:formData.filter(i => i.Row_Status != '1')}" ref="form1" :inline-message="true" style="width: 100%">
                            <el-table tooltip-effect="dark" border :data="formData.filter(i => i.Row_Status != '1')" height="calc(100vh - 310px)">
                                <el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
                                <el-table-column label="列名" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_NAME'"
                                            :rules="[{ required: true, message: '请输入列名', trigger: 'blur' }]">
                                            <el-input v-model="row.COLUMN_NAME" class="borderless-input" placeholder="请输入列名" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="数据类型" min-width="120">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_TYPE'"
                                            :rules="[{ required: true, message: '请输入数据类型', trigger: 'blur' }]">
                                            <el-select @change="changeType($event,row)" v-model="row.COLUMN_TYPE" placeholder="请输入数据类型" filterable style="width: 100%">
                                                <el-option v-for="item in ['varchar','longtext']" :key="item" :label="item" :value="item"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="长度" min-width="120">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_LENGTH'">
                                            <el-input @input="InputLength($event,row)" :disabled="row.COLUMN_TYPE == 'longtext'" v-model="row.COLUMN_LENGTH" class="borderless-input"
                                                placeholder="请输入长度" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="注释" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_COMMENT'">
                                            <el-input v-model="row.COLUMN_COMMENT" class="borderless-input"
                                                placeholder="请输入注释" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="默认值" min-width="100">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_DEFAULT'">
                                            <el-input :disabled="row.COLUMN_TYPE == 'longtext'" v-model="row.COLUMN_DEFAULT" class="borderless-input" placeholder="" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="允许为空" width="85" align="center">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.IS_NULLABLE'">
                                            <el-checkbox v-model="row.IS_NULLABLE"></el-checkbox>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="主键" width="85" align="center">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.PRIMARY'">
                                            <el-switch v-model="row.PRIMARY"></el-switch>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="操作" width="140" align="center">
                                    <template #header>
                                        <div style="display: flex; padding-right: 5px; justify-content: space-between;">
                                            <span>操作</span>
                                            <el-button type="primary" size="small" @click="handleAdd('formData')">新增</el-button>
                                        </div>
                                    </template>
                                    <template #default="{row}">
                                        <div style="display: flex; align-items: center;">
                                            <el-button id="move" type="success" size="small" style="cursor: move;">
                                                移动
                                            </el-button>
                                            <el-button size="small" type="danger" @click="handleRemove('formData',row)">
                                                删除
                                            </el-button>
                                        </div>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-form>
                    </el-tab-pane>
                    <el-tab-pane label="索引">
                        <el-form id="colum" :model="{indexData:indexData.filter(i => i.Row_Status != '1')}" ref="form2" :inline-message="true" style="width: 100%">
                            <el-table tooltip-effect="dark" border :data="indexData.filter(i => i.Row_Status != '1')" height="calc(100vh - 310px)">
                                <el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
                                <el-table-column label="名" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'indexData.' + $index + '.INDEX_NAME'"
                                            :rules="[{ required: true, message: '请输入名', trigger: 'blur' }]">
                                            <el-input v-model="row.INDEX_NAME" class="borderless-input" placeholder="请输入名" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="栏位" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'indexData.' + $index + '.COLUMN_NAME'"
                                            :rules="[{ required: true, message: '请选择栏位', trigger: 'blur' }]">
                                            <el-select @change="changeType($event,row)" v-model="row.COLUMN_NAME" placeholder="请选择栏位" filterable style="width: 100%">
                                                <el-option v-for="item in formData.filter(i => i.Row_Status != '1')" :key="item.COLUMN_NAME" :label="item.COLUMN_NAME" :value="item.COLUMN_NAME"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="操作" width="140" align="center">
                                    <template #header>
                                        <div style="display: flex; padding-right: 5px; justify-content: space-between;">
                                            <span>操作</span>
                                            <el-button type="primary" size="small" @click="handleAdd('indexData')">新增</el-button>
                                        </div>
                                    </template>
                                    <template #default="{row}">
                                        <div style="display: flex; align-items: center;">
                                            <el-button id="move" type="success" size="small" style="cursor: move;">
                                                移动
                                            </el-button>
                                            <el-button size="small" type="danger" @click="handleRemove('formData',row)">
                                                删除
                                            </el-button>
                                        </div>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-form>
                    </el-tab-pane>
                    <el-tab-pane label="外键">
                        <el-form id="colum" :model="{indexData:indexData.filter(i => i.Row_Status != '1')}" ref="form2" :inline-message="true" style="width: 100%">
                            <el-table tooltip-effect="dark" border :data="indexData.filter(i => i.Row_Status != '1')" height="calc(100vh - 310px)">
                                <el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
                                <el-table-column label="名" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_NAME'"
                                            :rules="[{ required: true, message: '请输入列名', trigger: 'blur' }]">
                                            <el-input v-model="row.COLUMN_NAME" class="borderless-input" placeholder="请输入列名" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="栏位" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_TYPE'"
                                            :rules="[{ required: true, message: '请输入数据类型', trigger: 'blur' }]">
                                            <el-select @change="changeType($event,row)" v-model="row.COLUMN_TYPE" placeholder="请输入数据类型" filterable style="width: 100%">
                                                <el-option v-for="item in ['varchar','longtext']" :key="item" :label="item" :value="item"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="参考数据库" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_NAME'"
                                            :rules="[{ required: true, message: '请输入列名', trigger: 'blur' }]">
                                            <el-input v-model="row.COLUMN_NAME" class="borderless-input" placeholder="请输入列名" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="被参考表" min-width="250">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_NAME'"
                                            :rules="[{ required: true, message: '请输入列名', trigger: 'blur' }]">
                                            <el-input v-model="row.COLUMN_NAME" class="borderless-input" placeholder="请输入列名" />
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="参考栏位" min-width="350">
                                    <template v-slot="{row,$index}">
                                        <el-form-item :prop="'formData.' + $index + '.COLUMN_TYPE'"
                                            :rules="[{ required: true, message: '请输入数据类型', trigger: 'blur' }]">
                                            <el-select @change="changeType($event,row)" v-model="row.COLUMN_TYPE" placeholder="请输入数据类型" filterable style="width: 100%">
                                                <el-option v-for="item in ['varchar','longtext']" :key="item" :label="item" :value="item"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </template>
                                </el-table-column>
                                <el-table-column label="操作" width="140" align="center">
                                    <template #header>
                                        <div style="display: flex; padding-right: 5px; justify-content: space-between;">
                                            <span>操作</span>
                                            <el-button type="primary" size="small" @click="handleAdd('formData')">新增</el-button>
                                        </div>
                                    </template>
                                    <template #default="{row}">
                                        <div style="display: flex; align-items: center;">
                                            <el-button id="move" type="success" size="small" style="cursor: move;">
                                                移动
                                            </el-button>
                                            <el-button size="small" type="danger" @click="handleRemove('formData',row)">
                                                删除
                                            </el-button>
                                        </div>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-form>
                    </el-tab-pane>
                </el-tabs>
            </div>
        </div>
        <footer class="botton-ann">
            <el-button @click="goBack">返回</el-button>
            <el-button type="primary" :loading="loading" plain @click="handleSubmit">提交</el-button>
        </footer>
    </div>
</body>
<script src="../../../utils/utils.js"></script>
<script src="../../../config/config.js"></script>
<script src="../../../utils/compressor.js"></script>
<script src="../../../utils/wangeditor.js"></script>
<script src="../../../utils/Sortable.min.js"></script>
<script src="../../../utils/mixins.js"></script>
<script src="../../../yl/vue.js"></script>
<script src="../../../yl/index.js"></script>
<script src="../../../yl/zh-cn.mjs"></script>
<script src="../../../yl/index.iife.min.js"></script>
<script src="../../../yl/jquery.min.js"></script>
<script src="../../../utils/jquery.cookie.js"></script>
<script src="../../../yl/jquery.easyui.min.js"></script>
<script src="../../../yl/jquery.easyui.mobile.js"></script>
<script src="../../../yl/moment.min.js"></script>
<script src="../../../api/request.js"></script>
<script src="./js/edit.js"></script>

</html>